#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char *argv[])
{
	int fd, pid;

	pid = fork();
	if(pid == 0)
	{
		execle("/bin/ls", NULL);
		exit(2);
	}

	if(waitpid(pid) < 0)
		printf("wait error\n");

	pid = fork();
	if(pid == 0)
	{
		fd = open("doc.txt", O_RDONLY);
		close(fd);
	}

	if(waitpid(pid) < 0)
		printf("wait error\n");

	exit(0);
}

